package eraserhead.xml.request;

import xml.Message;
import client.ServerAccess;
import eraserhead.entity.Edge;

/**
 * Class for sending an AddEdge request.
 * @author Michael Checca
 */
public class AddEdgeRequest {
	/**
	 * Sends a AddEdgeRequest to the server.
	 * @param sa {@link ServerAccess} to send request the {@link Message to}
	 * @param id Event id
	 * @param e {@link Edge} to request to add
	 */
	public static void send(ServerAccess sa, String id, Edge e) {
		String xmlMessage = String.format(
				"%s<addEdgeRequest id=\"%s\" left=\"%d\" right=\"%d\" height=\"%d\"/></request>",
				Message.requestHeader(), id, e.getLeft(), e.getRight(), e.getHeight());
		sa.sendRequest(new Message(xmlMessage));
	}
}
